
from Lib import _proxies
from Lib import _ipcheck
from Lib import _visit
from Lib import _conf
from time import sleep
from threading import Thread


def proxy_visit(pageInt):
    page = int(pageInt)
    while True:
        if _conf.visit_time('8:20','14:30') or _conf.visit_time('14:10','23:50'):
            print('>>>>>visit time true.线程======'+str(page))
            available_ip = _proxies.scraw_proxies(page)
            ip_uncheck = _ipcheck.check(available_ip)
            # 支持多个Url访问
            _visit.proxy_visit(_conf.target_urls, ip_uncheck)
        else:
            print('>>>>visit time false')
        sleep(2)    
        
        
if __name__ == '__main__':
    i = 1
    while i < 5:
        t = Thread(target=proxy_visit,args=(str(i)))
        t.start()
        i += 1;
    print('Thread End-----')